<!DOCTYPE html>
<html>
<head>
  <title>测试window.open</title>
  <meta charset="utf-8">
</head>
<body>
  <button onclick="doImmediately()">零延迟</button>
  <button onclick="doOneSecond()">1s延迟</button>
  <button onclick="settimeout()">setTimeout</button>
<script type="text/javascript">
  const open = () => window.open('https://www.baidu.com', '_blank1')
  const doImmediately = () => {
    const a = fetch('https://www.baidu.com', { mode: 'no-cors' })
    setTimeout(() => {
      a.then(open)
    }, 200)
  };

  const doOneSecond = () => {
    fetch('http://localhost:4000/api').then(open)
  };

  const settimeout = () => {
    setTimeout(open, 200);
  };

  const promiseTimeout = new Promise((resolve) => {
    console.log('loger promiseTimeout without time out################');
    setTimeout(() => {
      console.log('loger promiseTimeout inner time out################');
      resolve(12); 
    }, 1000); 
  });
  
  <!-- new Promise((resolve) => { -->
  <!--    console.log('loger promiseContainer#####################'); -->
  <!--    resolve(promiseTimeout); -->
  <!-- }).then((data) => { -->
  <!--    console.log('then two data', data); -->
  <!-- }); -->
  new Promise((resolve) => {
     console.log('loger promiseContainer#####################');
     resolve(13);
  }).then(promiseTimeout).then((data) => {
     console.log('then two data', data);
  });
  </script>
</body>
</html>
